var db = openDatabase('foo', '1.0', 'foo', 2 * 1024);
db.transaction(function (tx) {
	tx.executeSql('CREATE TABLE IF NOT EXISTS foo (id unique, text)');
	tx.executeSql('INSERT INTO foo (id, text) VALUES (1, "foobar")');
	document.querySelector('#status').innerHTML = '<p>foo created and row inserted.</p>';
});

db.transaction(function (tx) {
	tx.executeSql('DROP TABLE foo');

	// known to fail - so should rollback the DROP statement
	tx.executeSql('INSERT INTO foo (id, text) VALUES (1, "foobar")');
}, function (err) {
	document.querySelector('#status').innerHTML += '<p>should be rolling back caused by: <code>' + err.message + '</code></p>';
});

db.transaction(function (tx) {
	tx.executeSql('SELECT * FROM foo', [], function (tx, results) {
		document.querySelector('#status').innerHTML += '<p>found rows (should be 1): ' + results.rows.length + '</p>';
	}, function (tx, err) {
		document.querySelector('#status').innerHTML += '<p>failed (rollback failed): <em>' + err.message + '</em></p>';
		document.querySelector('#status').className = 'error';
	});
});